home *** CD-ROM | disk | FTP | other *** search
/ The Utilities Experience / The Utilities Experience - Volume 1.iso / software / comms / html-heaven / arexx / html-bed.rexx < prev    next >
OS/2 REXX Batch file  |  1996-01-08  |  2KB  |  39 lines

  1. /* HTML-Helper Arexx script for BED (Black's Editor)
  2.  * Ver      : 1.1 (7th January 1996)
  3.  * Copyright: Paul Kolenbrander (InterNet: paul@serena.iaehv.nl)
  4.  * Function : Pass on the HTML commands from HTML-Helper to BED.
  5.  * Input    : HTMLCMD - The HTML command to be inserted.
  6. */
  7.  
  8. OPTIONS RESULTS                             /* enable return codes     */
  9. PARSE ARG MYCMD HTMLCMD
  10.  
  11. HTMLCMD = SUBSTR(HTMLCMD,2, LENGTH(HTMLCMD)-1) /* strip leading space  */
  12.  
  13. ADDRESS 'BED_0'                             /* Default. Change if wish */
  14.  
  15. IF POS('><',HTMLCMD) ~= 0 THEN DO           /* Is it a split command?  */
  16.                                             /* If yes, then....        */
  17.    GetBlkInfo                               /* Check if there's a block*/
  18.    PARSE VAR RESULT BlockActive . BlockRow BlockCol
  19.    IF BlockActive = ON THEN DO              /* character block mode    */
  20.                                             /* Split HTMLCMD into parts*/
  21.       CMD2 = right(HTMLCMD,(LENGTH(HTMLCMD)-(LASTPOS('<',HTMLCMD))+1))
  22.       CMD1 = substr(HTMLCMD,1,(LENGTH(HTMLCMD)-LENGTH(CMD2)))
  23.       CMD1 = CMD1||'"'                      /* add a trailing "        */
  24.       CMD2 = '"'||CMD2                      /* add a leading "         */
  25.       GetCursorPos                          /* get cursor position     */
  26.       PARSE VAR RESULT CurLine CurCol .
  27.       Move CurLine CurCol                   /* Goto end of Block       */                                                     
  28.       Insert CMD2                           /* Insert close at cursor. */
  29.  
  30.       Move BlockRow BlockCol                /* Goto start of Block     */
  31.       Insert CMD1                           /* Insert open at cursor.  */
  32.       END
  33.       ELSE                                  /* no block mode           */
  34.         Insert HTMLCMD                      /* insert at current pos.  */
  35.    END
  36. ELSE
  37.    Insert HTMLCMD                           /* insert at current pos.  */
  38. EXIT
  39.